#include "fsmc.h"

void FSMC_Initialization(void)
{
  FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure={0};
  FSMC_NORSRAMTimingInitTypeDef FSMC_NORSRAMreadWriteInitStrucrure={0};

  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC,ENABLE);

  FSMC_NORSRAMreadWriteInitStrucrure.FSMC_AccessMode=FSMC_AccessMode_A;
  FSMC_NORSRAMreadWriteInitStrucrure.FSMC_AddressHoldTime=0x00;
  FSMC_NORSRAMreadWriteInitStrucrure.FSMC_AddressSetupTime=0x00;
  FSMC_NORSRAMreadWriteInitStrucrure.FSMC_BusTurnAroundDuration=0x00;
  FSMC_NORSRAMreadWriteInitStrucrure.FSMC_CLKDivision=0x00;
  FSMC_NORSRAMreadWriteInitStrucrure.FSMC_DataLatency=0x00;
  FSMC_NORSRAMreadWriteInitStrucrure.FSMC_DataSetupTime=0x03;

  FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait=FSMC_AsynchronousWait_Disable;
  FSMC_NORSRAMInitStructure.FSMC_Bank=FSMC_Bank1_NORSRAM3;
  FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode=FSMC_BurstAccessMode_Disable;
  FSMC_NORSRAMInitStructure.FSMC_DataAddressMux=FSMC_DataAddressMux_Disable;
  FSMC_NORSRAMInitStructure.FSMC_ExtendedMode=FSMC_ExtendedMode_Disable;
  FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth=FSMC_MemoryDataWidth_16b;
  FSMC_NORSRAMInitStructure.FSMC_MemoryType=FSMC_MemoryType_SRAM;
  FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct=&FSMC_NORSRAMreadWriteInitStrucrure;
  FSMC_NORSRAMInitStructure.FSMC_WaitSignal=FSMC_WaitSignal_Disable;
  FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive=FSMC_WaitSignalActive_BeforeWaitState;
  FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity=FSMC_WaitSignalPolarity_Low;
  FSMC_NORSRAMInitStructure.FSMC_WrapMode=FSMC_WrapMode_Disable;
  FSMC_NORSRAMInitStructure.FSMC_WriteBurst=FSMC_WriteBurst_Disable;
  FSMC_NORSRAMInitStructure.FSMC_WriteOperation=FSMC_WriteOperation_Enable;
  FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct=&FSMC_NORSRAMreadWriteInitStrucrure;
  FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);  //初始化FSMC配置
  FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM3,ENABLE);  // 使能BANK3
}